package com.wcs.spring.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.wcs.spring.entity.School;
import com.wcs.spring.mapper.SchoolMapper;
import com.wcs.spring.service.SchoolService;
import com.wcs.spring.util.PageUtil;

/**
 * <p>
 * Title: Phicomm_[子系统统名]_[模块名]
 * </p>
 * <p>
 * Description: [描述该类概要功能介绍]
 * </p>
 * 
 * @author hexuan2014
 * @version $Revision$ 2015-6-15
 * @author (lastest modification by $Author$)
 * @since 1.0
 */
@Repository(value = "schoolService")
public class SchoolServiceImpl implements SchoolService {

	@Resource(name = "schoolMapper")
	private SchoolMapper schoolMapper;

	@Override
	public List<School> querySchoolList(School school, PageUtil pageUtil) {
		StringBuilder sql = new StringBuilder();
		sql.append(" select * from school u where u.flag=0 order by u.updateTime desc ");
		return schoolMapper.querySchoolList(sql.toString());
	}

	@Override
	public List<School> querySchoolSimple() {
		StringBuilder sql = new StringBuilder();
		sql.append(" select u.id,u.schoolName from school u where u.flag=0 order by u.schoolName asc ");
		return schoolMapper.querySchoolList(sql.toString());
	}

	@Override
	public int addSchool(School school) {
		// TODO Auto-generated method stub
		return schoolMapper.addSchool(school);
	}

	@Override
	public void updateSchool(School school) {
		// TODO Auto-generated method stub
		schoolMapper.updateSchool(school);
	}

	@Override
	public void delSchool(School school) {
		// TODO Auto-generated method stub
		schoolMapper.delSchool(school);
	}

	@Override
	public School querySchoolById(Integer id) {
		// TODO Auto-generated method stub
		return schoolMapper.querySchoolById(id);
	}

}
